package com.linys.scala.study.demo

/**
  * Created by admin on 2019/10/11.
  */
object Timer {
  var i = 0
  def oncePerSecond(callback: () => Unit): Unit = {
    while (true) { callback(); Thread sleep 3000 }
  }
  def timeFlies(): Unit = {
    i = i + 1
    println("time flies like an arrow..." + i)
  }
  def main(args: Array[String]): Unit = {
    oncePerSecond(timeFlies)
  }
}
